#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <fstream>
#include <unordered_map>
enum
{
    OPEN_ERROR = 1
};
class dict {

public:
    dict(const char* path)
    {
        inputFile.open(path);
        if (inputFile.is_open()) {
            loaddate();
        }
        else {
        }
        inputFile.close();

    }
    ~dict() {

    }
    std::string translate(std::string key) {
        auto it = date.find(key);
        return it->second;
    }
private:
    void loaddate() {
        std::string temp;
        int i = 0;
        while (std::getline(inputFile, temp)) {
            if (temp.empty())
                continue;
            int np3 = temp.find_first_of(':');
            std::string key_s = temp.substr(0, np3);
            std::string va_s;
            i = temp.size() - 1;
            if (i>(np3+2))
                va_s = temp.substr(np3 + 2,i);
            else
                date.insert(std::make_pair(key_s, "none trans"));
            date.insert(std::make_pair(key_s, va_s));
        }
    }
private:
    std::unordered_map<std::string, std::string> date;
    std::ifstream inputFile;
};
int main() {
    dict text("dict.txt");
    int i = 1;
}